<template>
	<view class="content">
		<view class="header">
		
		</view>
		<view class="tuijian">
			<view class="tuijian_con"  v-for="(item, i) in collectionlist" :key="i" v-if="collectionlist != ''" @click="Detail(item.goods_id)">
				<view class="sec_center" >
					<view class="center"><image :src="item.cover_pic"></image></view>
					<view class="right">
						<text class="name">{{item.title}}</text>
						<text class="yuanqi">大王币：{{item.integral}}</text>
						<text class="cont">￥{{item.price}}</text>
					</view>
					<view class="shoucangbtn flexs" @click.stop="backcoll(item.cid,i)">
						<text>取消收藏</text>
					</view>
				</view>
			</view>
		</view>
		<view class="emptya flex-column flex-c-c" v-if="collectionlist == ''">
			<!-- <image src="https://pd.pdaxiang.com/upload/static/index/null.png"></image> -->
			<text class="size-32 color-h">暂无收藏</text>
		</view>
		<u-modal v-model="Shouhuoshow" content="确定收货吗?" :show-cancel-button="true" @confirm="payConfirm"></u-modal>
		<u-loadmore :status="morestatus" v-if="collectionlist!='' && collectionlist.length>5"/>
	</view>
</template>

<script>
export default {
	data() {
		return {
			morestatus:"loadmore",
			urls: this.$configs.urls,
			Shouhuoshow:false,
			collectionlist: [],
			page:1,
			status:0,
			order_id:"",//订单id
			jimaiyulan:{},
			allStatus:false,
			total_recovery_price:""
		};
	},
	onLoad(option) {
		//从发货进来
		if(option.type==1){
			this.status = 1;
			this.getlist()
		}
	},
	onShow() {
		this.getlist()
	},
	onPullDownRefresh() {
		this.page=1;
		this.collectionlist = []
		this.getlist();
	},
	onReachBottom() {
		this.page++;
		this.morestatus = "loading"
		this.getlist(2);
	},
	onHide() {
		this.allStatus = false;
		this.$refs.jimaiStatus.close()
	},
	methods: {
		Detail(goods_id){
			uni.navigateTo({
				url:"/mallPage/mall/goodsdetail?goods_id=" + goods_id
			})
		},
		backcoll(cid,i){
			let data = {
				cid:cid
			}
			this.$Request.post(this.$api.user.collectiondel,data).then(res => {
				uni.showToast({
					title:res.msg,
					icon:"none"
				})
				this.collectionlist.splice(i,1)
			});
		},
		getlist(type){
			let data = {
				page:this.page,
			}
			uni.showLoading({
				title:"加载中..."
			})
			this.$Request.get(this.$api.user.getList,data).then(res => {
				setTimeout(function() {
					uni.stopPullDownRefresh();
				}, 1000);
				 clearTimeout();
				uni.hideLoading()
				if(type==2){
					this.collectionlist = this.collectionlist.concat(res.data.list);
					if(res.data.list==''){
						this.morestatus = "nomore"
					}
				}else{
					this.collectionlist = res.data.list;
					this.morestatus = "loadmore"
				}
			});
		}
		
	}
};
</script>

<style lang="scss" scoped>
.content {
	min-height: 100vh;
	background: #FFFFFF;
	padding-top: 20rpx;

	.checkNav {
		color: #fd8e1b !important;
		border-bottom: 2rpx solid #fd8e1b !important;
	}
	.tuijian {
		background: #ffffff;
		padding-top: 20rpx;
		padding-bottom: 20rpx;
		position: relative;
		.sec_right{
			position: absolute;
			right: 40rpx;
			top: 40rpx;
			text{
				font-size: 24rpx;
				font-family: PingFang SC;
				font-weight: 800;
				color: #000000;
			}
		}
		.sec_bottom {
			.view_title{
				font-size: 24rpx;
				font-family: PingFang SC;
				font-weight: 500;
				color: #000000;
			}
			.bom {
				width: 100%;
				display: flex;
				align-items: center;
				justify-content: space-between;
				margin-top: 22rpx;
				.left {
					display: flex;
					align-items: center;
					text:nth-child(1) {
						font-size: 24rpx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #000000;
						max-width: 240rpx;
						word-break: break-all;
						text-overflow: ellipsis;
						overflow: hidden;
						display: -webkit-box;
						-webkit-line-clamp: 1;
						-webkit-box-orient: vertical;
					}
				}
				.right {
					font-size: 29rpx;
					font-family: PingFang SC;
					font-weight: bold;
					color: #ffffff;
					text-align: center;
					line-height: 24rpx;
					background: #fd8e1b;
					border-radius: 10rpx;
					padding: 8rpx 26rpx 8rpx 26rpx;
				}
			}
		}
		.tuijian_con {
			width: 710rpx;
			margin: 0 auto;
			padding: 20rpx;
			background-size: 100% 100% !important;
			background-repeat: no-repeat !important;
			margin-bottom: 10rpx;
			border-radius: 20rpx;
			box-shadow: 0px 3px 14px rgba(0, 0, 0, 0.16);
			.sec_center {
				width: 710rpx;
				margin: 0 auto;
				display: flex;
				position: relative;
				.shoucangbtn{
					width: 160rpx;
					height: 60rpx;
					background: #999999;
					border-radius: 10rpx;
					position: absolute;
					right: 40rpx;
					bottom: 20rpx;
					text{
						font-size: 26rpx;
						font-family: PingFang SC;
						font-weight: 400;
						color: #FFFFFF;
					}
				}
				.center {
					padding: 10rpx 0 10rpx 0;
					image {
						width: 218rpx;
						height: 190rpx;
						border-radius: 10rpx;
					}
				}
				.right {
					margin-left: 20rpx;
					display: flex;
					flex-direction: column;
					justify-content: space-around;
					padding: 0 20rpx 0 0;
					box-sizing: border-box;
					.name {
						max-width: 340rpx;
						font-size: 28rpx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #000000;
						margin-top: 6rpx;
						display: -webkit-box;
						-webkit-box-orient: vertical;
						-webkit-line-clamp: 2;
						text-align: justify;
						overflow: hidden;
					}
					.yuanqi{
						font-size: 24rpx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #666666;
					}
					.cont {
						font-size: 32rpx;
						font-family: PingFang SC;
						font-weight: 500;
						color: #E80303;
						display: -webkit-box;
						-webkit-box-orient: vertical;
						-webkit-line-clamp: 2;
						text-align: justify;
						overflow: hidden;
						padding-right: 20rpx;
						box-sizing: border-box;
					}
					.bom {
						min-width: 320rpx;
						display: flex;
						align-items: center;
						justify-content: space-between;
						margin-top: 2rpx;
						.left {
							display: flex;
							align-items: center;
							text:nth-child(1) {
								font-size: 24rpx;
								font-family: PingFang SC;
								font-weight: 500;
								color: #000000;
							}
						}
						.right {
							font-size: 29rpx;
							font-family: PingFang SC;
							font-weight: bold;
							color: #ffffff;
							text-align: center;
							line-height: 24rpx;
							background: #fd8e1b;
							border-radius: 10rpx;
							padding: 16rpx 26rpx 16rpx 26rpx;
						}
					}
				}
			}
		}
	}
	.header {
		width: 750rpx;
	
	}
}
</style>
